Copyright(C) 1994 Terumasa KODAKA , Takeshi KONO ■Keyboard BIOS Term Key code A value that indicates which key on the keyboard was pressed. It is expressed in 8 bits. It is almost the same as the key number, but for some keys (function keys, [HOME CLR], [XFER], [NFER]), the key code changes depending on the state of the [SHIFT] or [CTRL] key that was pressed at the same time. Related Table [Key code/key data] Term Key data A value that conforms to the ASCII/JIS code. It is expressed in 8 bits. If a key other than a character key (return key, function key, arrow key, [ROLL UP], [ROLL DOWN], [INS], [DEL], [HOME CLR], [HELP], [STOP], [COPY]) is pressed, it becomes 00h. Related Table [Key code/key data] Term Key number A value that corresponds one-to-one with all keys on the keyboard. It is expressed in 7 bits. The shift keys, [STOP], and [COPY] keys also have key numbers. Terminology Key input data In this book, the data stored in the key buffer will be called "key input data". Key input data is stored in the key buffer in the following procedure. When a key is pressed (Make) or released (Break), the keyboard sends the key number of the key whose state has changed and the Make/Break state to the main unit as serial data. When the keyboard interface 8251A on the main unit receives data from the keyboard, it generates a keyboard interrupt (INT 09h). In normal mode, the keyboard interrupt (INT 09h) handler converts the received key number and current shift state into a key code and key data, and stores them in the key buffer. In high-resolution mode, the received key number and shift state are stored in the key buffer as is. In both modes, key input data is stored in pairs of 2 bytes in the key buffer. Table Key Codes and Key Data ---------------+-------------------------------------------------------+--------- Key number | Key code (left), key data (right) in each shift state | Target +------+------+------+------+------+------+------+------+ (Key top | |+SHIFT|+CAPS |+CAPS |+Kana |+Kana |+GRPH |+CTRL | Notation) | | | |+SHIFT| |+SHIFT| | | ---------------+------+------+------+------+------+------+------+------+--------- 00[ ESC ] |00,1B |00,1B |00,1B |00,1B |00,1B |00,1B |00,1B |00,1B | 01[ 1!ヌ ] |01,31 |01,21 |01,31 |01,21 |01,C7 |01,C7 |----- |----- | 02[ 2"フ ] |02,32 |02,22 |02,32 |02,22 |02,CC |02,CC |----- |----- | 03[ 3#アァ ] |03,33 |03,23 |03,33 |03,23 |03,B1 |03,A7 |----- |----- | 04[ 4$ウゥ ] |04,34 |04,24 |04,34 |04,24 |04,B3 |04,A9 |----- |----- | 05[ 5%エェ ] |05,35 |05,25 |05,35 |05,25 |05,B4 |05,AA |05,F2 |----- | 06[ 6&オォ ] |06,36 |06,26 |06,36 |06,26 |06,B5 |06,AB |06,F3 |----- | 07[ 7'ヤャ ] |07,37 |07,27 |07,37 |07,27 |07,D4 |07,AC |07,F4 |----- | 08[ 8(ユュ ] |08,38 |08,28 |08,38 |08,28 |08,D5 |08,AD |08,F5 |----- | 09[ 9)ヨョ ] |09,39 |09,29 |09,39 |09,29 |09,D6 |09,AE |09,F6 |----- | 0A[ 0ワヲ ] |0A,30 |0A,30 |0A,30 |0A,30 |0A,DC |0A,A6 |0A,F7 |----- | 0B[ -=ホ ] |0B,2D |0B,3D |0B,2D |0B,3D |0B,CE |0B,CE |0B,8C |----- | 0C[ ^`ヘ ] |0C,5E |0C,60 |0C,5E |0C,60 |0C,CD |0C,CD |0C,8B |0C,1E |*1 0C[ ^ヘ ] |0C,5E |0C,5E |0C,5E |0C,5E |0C,CD |0C,CD |0C,8B |0C,1E |*2 0D[ ¥|ー ] |0D,5C |0D,7C |0D,5C |0D,7C |0D,B0 |0D,B0 |0D,F1 |0D,1C | 0E[ BS ] |0E,08 |0E,08 |0E,08 |0E,08 |0E,08 |0E,08 |0E,08 |0E,08 |*3 0F[ TAB ] |0F,09 |0F,09 |0F,09 |0F,09 |0F,09 |0F,09 |0F,09 |0F,09 | 10[ Q タ ] |10,71 |10,51 |10,51 |10,71 |10,C0 |10,C0 |10,9C |10,11 | 11[ W テ ] |11,77 |11,57 |11,57 |11,77 |11,C3 |11,C3 |11,9D |11,17 | 12[ E イ ] |12,65 |12,45 |12,45 |12,65 |12,B2 |12,A8 |12,E4 |12,05 | 13[ R ス ] |13,72 |13,52 |13,52 |13,72 |13,BD |13,BD |13,E5 |13,12 | 14[ T カ ] |14,74 |14,54 |14,54 |14,74 |14,B6 |14,B6 |14,EE |14,14 | 15[ Y ン ] |15,79 |15,59 |15,59 |15,79 |15,DD |15,DD |15,EF |15,19 | 16[ U ナ ] |16,75 |16,55 |16,55 |16,75 |16,C5 |16,C5 |16,F0 |16,15 | 17[ I ニ ] |17,69 |17,49 |17,49 |17,69 |17,C6 |17,C6 |17,E8 |17,09 | 18[ O ラ ] |18,6F |18,4F |18,4F |18,6F |18,D7 |18,D7 |18,E9 |18,0F | 19[ P セ ] |19,70 |19,50 |19,50 |19,70 |19,BE |19,BE |19,8D |19,10 | 1A[ @‾ ] |1A,40 |1A,7E |1A,40 |1A,7E |1A,DE |1A,DE |1A,8A |1A,00 | 1B[ [{ ] |1B,5B |1B,7B |1B,5B |1B,7B |1B,DF |1B,A2 |----- |1B,1B | 1C[ RETURN ] |1C,0D |1C,0D |1C,0D |1C,0D |1C,0D |1C,0D |1C,0D |1C,0D | 1D[ A チ ] |1D,61 |1D,41 |1D,41 |1D,61 |1D,C1 |1D,C1 |1D,9E |1D,01 | 1E[ S ト ] |1E,73 |1E,53 |1E,53 |1E,73 |1E,C4 |1E,C4 |1E,9F |1E,13 | 1F[ D シ ] |1F,64 |1F,44 |1F,44 |1F,64 |1F,BC |1F,BC |1F,E6 |1F,04 | 20[ F ハ ] |20,66 |20,46 |20,46 |20,66 |20,CA |20,CA |20,E7 |20,06 | 21[ G キ ] |21,67 |21,47 |21,47 |21,67 |21,B7 |21,B7 |21,EC |21,07 | 22[ H ク ] |22,68 |22,48 |22,48 |22,68 |22,B8 |22,B8 |22,ED |22,08 | 23[ J マ ] |23,6A |23,4A |23,4A |23,6A |23,CF |23,CF |23,EA |23,0A | 24[ K ノ ] |24,6B |24,4B |24,4B |24,6B |24,C9 |24,C9 |24,EB |24,0B | 25[ L リ ] |25,6C |25,4C |25,4C |25,6C |25,D8 |25,D8 |25,8E |25,0C | 26[ ;+レ ] |26,3B |26,2B |26,3B |26,2B |26,DA |26,DA |26,89 |----- | 27[ :*ケ ] |27,3A |27,2A |27,3A |27,2A |27,B9 |27,B9 |27,94 |----- | 28[ }]ム」 ] |28,5D |28,7D |28,5D |28,7D |28,D1 |28,A3 |----- |28,1D | 29[ Z ツッ ] |29,7A |29,5A |29,5A |29,7A |29,C2 |29,AF |29,80 |29,1A | 2A[ X サ ] |2A,78 |2A,58 |2A,58 |2A,78 |2A,BB |2A,BB |2A,81 |2A,18 | 2B[ C ソ ] |2B,63 |2B,43 |2B,43 |2B,63 |2B,BF |2B,BF |2B,82 |2B,03 | 2C[ V ヒ ] |2C,76 |2C,56 |2C,56 |2C,76 |2C,CB |2C,CB |2C,83 |2C,16 | 2D[ B コ ] |2D,62 |2D,42 |2D,42 |2D,62 |2D,BA |2D,BA |2D,84 |2D,02 | 2E[ N ミ ] |2E,6E |2E,4E |2E,4E |2E,6E |2E,D0 |2E,D0 |2E,85 |2E,0E | 2F[ M モ ] |2F,6D |2F,4D |2F,4D |2F,6D |2F,D3 |2F,D3 |2F,86 |2F,0D | 30[ ,<ネ。 ] |30,2C |30,3C |30,2C |30,3C |30,C8 |30,A4 |30,87 |----- | 31[ .>ル。 ] |31,2E |31,3E |31,2E |31,3E |31,D9 |31,A1 |31,88 |----- | 32[ /?メ・ ] |32,2F |32,3F |32,2F |32,3F |32,D2 |32,A5 |32,97 |----- | 33[ _ロ ] |----- |33,5F |----- |33,5F |33,DB |33,DB |----- |33,1F |*4 33[ _ロ ] |33,FC |33,5F |33,FC |33,5F |33,DB |33,DB |----- |33,1F |*5 34[ SPACE ] |34,20 |34,20 |34,20 |34,20 |34,20 |34,20 |34,20 |34,20 | 35[ XFER ] |35,00 |A5,00 |35,00 |A5,00 |35,00 |A5,00 |35,00 |B5,00 | 36[ ROLL UP ] |36,00 |36,00 |36,00 |36,00 |36,00 |36,00 |36,00 |36,00 |*3 37[ ROLL DOWN ]|37,00 |37,00 |37,00 |37,00 |37,00 |37,00 |37,00 |37,00 |*3 38[ INS ] |38,00 |38,00 |38,00 |38,00 |38,00 |38,00 |38,00 |38,00 | 39[ DEL ] |39,00 |39,00 |39,00 |39,00 |39,00 |39,00 |39,00 |39,00 |*3 39[ DEL BS ] |39,08 |39,08 |39,08 |39,08 |39,08 |39,08 |39,08 |39,08 |*6 3A[ ↑ ] |3A,00 |3A,00 |3A,00 |3A,00 |3A,00 |3A,00 |3A,00 |3A,00 | 3B[ ← ] |3B,00 |3B,00 |3B,00 |3B,00 |3B,00 |3B,00 |3B,00 |3B,00 | 3C[ → ] |3C,00 |3C,00 |3C,00 |3C,00 |3C,00 |3C,00 |3C,00 |3C,00 | 3D[ ↓ ] |3D,00 |3D,00 |3D,00 |3D,00 |3D,00 |3D,00 |3D,00 |3D,00 | 3E[ HOME CLR ] |3E,00 |AE,00 |3E,00 |AE,00 |3E,00 |AE,00 |----- |----- |*7 3E[ CLR ] |3E,00 |AE,00 |3E,00 |AE,00 |3E,00 |AE,00 |----- |----- |*8 3F[ HELP ] |3F,00 |3F,00 |3F,00 |3F,00 |3F,00 |3F,00 |3F,00 |3F,00 |*3 40[ - ] |40,2D |40,2D |40,2D |40,2D |40,2D |40,2D |40,2D |40,2D | 41[ / ] |41,2F |41,2F |41,2F |41,2F |41,2F |41,2F |41,2F |41,2F | 42[ 7 ] |42,37 |42,37 |42,37 |42,37 |42,37 |42,37 |42,98 |42,37 | 43[ 8 ] |43,38 |43,38 |43,38 |43,38 |43,38 |43,38 |43,91 |43,38 | 44[ 9 ] |44,39 |44,39 |44,39 |44,39 |44,39 |44,39 |44,99 |44,39 | 45[ * ] |45,2A |45,2A |45,2A |45,2A |45,2A |45,2A |45,95 |45,2A | 46[ 4 ] |46,34 |46,34 |46,34 |46,34 |46,34 |46,34 |46,E1 |46,34 | 47[ 5 ] |47,35 |47,35 |47,35 |47,35 |47,35 |47,35 |47,E2 |47,35 | 48[ 6 ] |48,36 |48,36 |48,36 |48,36 |48,36 |48,36 |48,E3 |48,36 | 49[ + ] |49,2B |49,2B |49,2B |49,2B |49,2B |49,2B |49,E0 |49,2B | 4A[ 1 ] |4A,31 |4A,31 |4A,31 |4A,31 |4A,31 |4A,31 |4A,93 |4A,31 | 4B[ 2 ] |4B,32 |4B,32 |4B,32 |4B,32 |4B,32 |4B,32 |4B,8F |4B,32 | 4C[ 3 ] |4C,33 |4C,33 |4C,33 |4C,33 |4C,33 |4C,33 |4C,92 |4C,33 | 4D[ = ] |4D,3D |4D,3D |4D,3D |4D,3D |4D,3D |4D,3D |4D,96 |4D,3D | 4E[ 0 ] |4E,30 |4E,30 |4E,30 |4E,30 |4E,30 |4E,30 |4E,9A |4E,30 | 4F[ , ] |4F,2C |4F,2C |4F,2C |4F,2C |4F,2C |4F,2C |4F,90 |4F,2C | 50[ . ] |50,2E |50,2E |50,2E |50,2E |50,2E |50,2E |50,9B |50,2E | 51[ NFER ] |51,00 |A1,00 |51,00 |A1,00 |51,00 |A1,00 |51,00 |B1,00 |*9 52[ vf・1 ] |52,00 |C2,00 |52,00 |C2,00 |52,00 |C2,00 |----- |D2,00 |*10 52[ f・11 ] |52,00 |C2,00 |52,00 |C2,00 |52,00 |C2,00 |----- |D2,00 |*11 53[ vf・2 ] |53,00 |C3,00 |53,00 |C3,00 |53,00 |C3,00 |----- |D3,00 |*10 53[ f・12 ] |53,00 |C3,00 |53,00 |C3,00 |53,00 |C3,00 |----- |D3,00 |*11 54[ vf・3 ] |54,00 |C4,00 |54,00 |C4,00 |54,00 |C4,00 |----- |D4,00 |*10 54[ f・13 ] |54,00 |C4,00 |54,00 |C4,00 |54,00 |C4,00 |----- |D4,00 |*11 55[ vf・4 ] |55,00 |C5,00 |55,00 |C5,00 |55,00 |C5,00 |----- |D5,00 |*10 55[ f・14 ] |55,00 |C5,00 |55,00 |C5,00 |55,00 |C5,00 |----- |D5,00 |*11 56[ vf・5 ] |56,00 |C6,00 |56,00 |C6,00 |56,00 |C6,00 |----- |D6,00 |*10 56[ f・15 ] |56,00 |C6,00 |56,00 |C6,00 |56,00 |C6,00 |----- |D6,00 |*11 5E[ HOME ] |AE,00 |AE,00 |AE,00 |AE,00 |AE,00 |AE,00 |----- |----- |*8 60[ STOP ] |60,00 |60,00 |60,00 |60,00 |60,00 |60,00 |----- |60,00 |*12 60[ STOP ] |----- |----- |----- |----- |----- |----- |----- |----- |*13 61[ COPY ] |61,00 |61,00 |61,00 |61,00 |61,00 |61,00 |----- |61,00 |*14 61[ COPY ] |----- |----- |----- |----- |----- |----- |----- |----- |*15,*3 62[ f・1 ] |62,00 |82,00 |62,00 |82,00 |62,00 |82,00 |----- |92,00 | 63[ f・2 ] |63,00 |83,00 |63,00 |83,00 |63,00 |83,00 |----- |93,00 | 64[ f・3 ] |64,00 |84,00 |64,00 |84,00 |64,00 |84,00 |----- |94,00 | 65[ f・4 ] |65,00 |85,00 |65,00 |85,00 |65,00 |85,00 |----- |95,00 | 66[ f・5 ] |66,00 |86,00 |66,00 |86,00 |66,00 |86,00 |----- |96,00 | 67[ f・6 ] |67,00 |87,00 |67,00 |87,00 |67,00 |87,00 |----- |97,00 | 68[ f・7 ] |68,00 |88,00 |68,00 |88,00 |68,00 |88,00 |----- |98,00 | 69[ f・8 ] |69,00 |89,00 |69,00 |89,00 |69,00 |89,00 |----- |99,00 | 6A[ f・9 ] |6A,00 |8A,00 |6A,00 |8A,00 |6A,00 |8A,00 |----- |9A,00 | 6B[ f・10 ] |6B,00 |8B,00 |6B,00 |8B,00 |6B,00 |8B,00 |----- |9B,00 | 70[ SHIFT ] |70,00 |70,00 |70,00 |70,00 |70,00 |70,00 |70,00 |70,00 |*16 70[ SHIFT ] |----- |----- |----- |----- |----- |----- |----- |----- |*17 71[ CAPS ] |71,00 |71,00 |71,00 |71,00 |71,00 |71,00 |71,00 |71,00 |*18 71[ CAPS ] |----- |----- |----- |----- |----- |----- |----- |----- |*19 72[ カナ ] |72,00 |72,00 |72,00 |72,00 |72,00 |72,00 |72,00 |72,00 |*20 72[ カナ ] |----- |----- |----- |----- |----- |----- |----- |----- |*21 73[ GRPH ] |73,00 |73,00 |73,00 |73,00 |73,00 |73,00 |73,00 |73,00 |*22 73[ GRPH ] |----- |----- |----- |----- |----- |----- |----- |----- |*23 74[ CTRL ] |74,00 |74,00 |74,00 |74,00 |74,00 |74,00 |74,00 |74,00 |*24 74[ CTRL ] |----- |----- |----- |----- |----- |----- |----- |----- |*25 ---------------+------+------+------+------+------+------+------+------+----- *1:High-resolution mode, new keyboard models, V30HL, V33A models *2:Normal mode for 8086/V30 models, PC-9801VX2/VX21/UX, PC-98XL/XL^2 (Some models have the [`] marking but cannot be entered) *3:PC-98LT does not have the [BS], [ROLL UP], [ROLL DOWN], [DEL], [HELP], and [COPY] keys, but they can be substituted with the following operations. [BS],[DEL] = [DEL BS] [HELP] = [CTRL]+[SHIFT]+[H] [ROLL UP] = [CTRL]+[SHIFT]+[↑] [ROLL DOWN] = [CTRL]+[SHIFT]+[↓] [COPY] = [CTRL]+[SHIFT]+[P] *4:Normal mode *5:High-resolution mode *6:PC-98LT only *7:Other than PC-98XA, XL, and XL^2 *8:PC-98XA, XL, and XL^2 *9:Other than PC-9801 original, E, F, and M *10:Machines with new keyboard *11:High-resolution mode for PC-98XA, XL, and XL^2 *12:When the INT 06h generating key is defined as another key in high-resolution mode *13: When defined as INT 06h generation key in normal, PC-98LT・HA, and in high-resolution mode *14: When defined as INT 05h generation key in high-resolution mode as another key *15: When defined as INT 05h generation key in normal, PC-98LT・HA, and in high-resolution mode as another key *16: When defined as SHIFT key code in high-resolution mode as another key *17: When defined as SHIFT key in normal, PC-98LT・HA, and in high-resolution mode as another key *18: When defined as CAPS key code in high-resolution mode as another key *19: When defined as CAPS key in normal, PC-98LT・HA, and in high-resolution mode as another key *20: When defined as kana key code in high-resolution mode as another key *21: When defined as kana key in normal, PC-98LT・HA, and in high-resolution mode as another key *22: When the GRPH key code is defined as another key in high-resolution mode *23: When defined as a GRPH key in normal, PC-98LT-HA, and in high-resolution mode *24: When the CTRL key code is defined as another key in high-resolution mode *25: When defined as a CTRL key in normal, PC-98LT-HA, and in high-resolution mode * ----- means that no data will be entered when pressed in that shift state. * It is impossible to distinguish which of the left and right shift keys has been pressed. * It is impossible to distinguish which of the return keys on the full keypad side and the return key on the numeric keypad side has been pressed. * On laptops, notebooks, etc., it is impossible to distinguish between input from the numeric keypad and input from the keys on the main unit that have been put into numeric keypad mode with the [NUM] key ON. * The [NUM] key on laptops, notebooks, etc. is not controlled by the keyboard BIOS but is managed by hardware, so no key number is assigned. The [NUM] key's ON/OFF state cannot be obtained from the BIOS or the system common area. For new keyboards, this can be obtained by issuing a downstream command to the keyboard. For keyboards that are not new, there is no way to obtain it. * Shift keys, [STOP], and [COPY] do not enter the key buffer, so key data cannot be obtained with INT 18h - Function 00h, 01h, 05h, 07h, and 08h, but their press can be recognized with INT 18h - Function 04h. When [COPY] or [STOP] is pressed, the keyboard BIOS executes INT 05h and 06h. However, in high-resolution mode, shift keys and the keys that generate INT 05h and 06h can be redefined, so in that case the [SHIFT], [CAPS], [Kana], [GRPH], [CTRL], [STOP], and [COPY] keys also enter the key buffer. * On the PC-98XL and XL^2, the behavior of [CLR] and [HOME] is the same in both normal and high-resolution modes. Table List of keys that do not auto-repeat -------------------------------- [f・1]〜[f・10] [vf・1]〜[vf・5]([f・11]〜[f・15]) [INS] [SHIFT] [CAPS] [Kana] [GRPH] [CTRL] -------------------------------- INT 18h - Function 00h Classification KEYBOARD BIOS Name Read key data (wait for 1 character input) Target Normal, Hi-Res, PC-98LT/HA Input AH=00h Output AH=key code AL=key data ■[Hi-Res] AX=FFFFh : Finished without key input (see explanation) Explanation o Extracts 1 character of key input data from the key buffer and outputs the key code and key data (for key code and key data, see table [Key Code/Key Data]). If there is no key input data in the key buffer, it will not finish until a key is pressed. However, in the case of Hi-Res, in special cases explained later, it may finish even if no key is pressed. In this case, AX=FFFFh. u In 98NOTE and PC-98HA, the following process is performed to reduce power consumption during the key input waiting loop. Execute 98NOTE HLT Execute PC-98HA INT 1Fh - Function B9h u In high-resolution mode, INT 1Fh - Function 8000h may be executed when waiting for key input, ostensibly to support multitasking. In this case, this function may terminate even if there is no key input. To specifically explain under what conditions this occurs, the processing procedure for this function in high-resolution mode is shown below. 1. When this function is called, if there is key input data in the key buffer, the data is converted to a key code and key data. If the converted data results in key input, the key code and key data are stored in the AX register and the function terminates. 2. If there is no key input data in the key buffer, or if there is only data that does not result in key input (such as [CTRL]+[1]), INT 1Fh - Function 8000h is executed. 3. When INT 1Fh - Function 8000h is returned with CF=0, it will loop until a key is pressed (until there is key input data in the key buffer). When a key is pressed, it will return to 1. INT 1Fh will not be executed during the loop. 4. When INT 1Fh - Function 8000h is returned with CF=1, if there is key input data in the key buffer at that time (a key is pressed while INT 1Fh is being executed), it will return to 1. 5. When INT 1Fh - Function 8000h is returned with CF=1, if there is no key input data in the key buffer at that time (a key is not pressed while INT 1Fh is being executed), it will end with AX=FFFFh. Related 0000:0502-0521h 0000:0524-0525h 0000:0528h Table [Key Code/Key Data] 0000:0410-0413h [Hi-Res] 0000:0522h [Hi-Res] INT 1Fh - Function 8000h [Hi-Res] INT 18h - Function 01h Classification KEYBOARD BIOS Name Sense of key buffer state Target Normal, High Resolution, PC-98LT/HA Input AH=01h Output BH=Presence or absence of key input data 00h: No key input data 01h: Key input data exists When BH=01h AH=Key code AL=Key data When BH=00h AX=Undefined Explanation o Refers to the first character of key input data in the key buffer and outputs the key code and key data (for key codes and key data, see Table [Key Codes and Key Data]). If there is no key input data in the key buffer, it immediately ends. Even if this function is executed, the number of key input data in the key buffer does not change. Related 0000:0502-0521h 0000:0524-0525h 0000:0528h Table [Key Code/Key Data] 0000:0410-0413h [Hi-Res] 0000:0522h [Hi-Res] INT 18h - Function 02h Classification KEYBOARD BIOS Name Sense of shift key state Target Normal, Hi-Res, PC-98LT/HA Input AH=02h Output AL=shift state bit 7-5:000b bit 4:[CTRL] bit 3:[GRPH] bit 2:[Kana] bit 1:[CAPS] bit 0:[SHIFT] 1 = ON 0 = OFF AH=undefined Explanation o Returns the pressed state of the shift keys ([CTRL],[GRPH],[Kana],[CAPS],[SHIFT]) at the time of execution of this function, regardless of the key buffer. o In Hi-Res mode, the shift key can be changed by rewriting the shift key code table (0000:0408h). In this case, the shift key corresponding to each bit follows the definition of the shift key code table. The table shows the default shift key. Related 0000:053Ah 0000:0408-040Fh [Hi-Res] INT 18h - Function 03h Category KEYBOARD BIOS Name Keyboard interface initialization Target Normal, Hi-Res, PC-98LT/HA Input AH=03h Output AX=Undefined Explanation o Initializes the system common area used by the keyboard BIOS, the keyboard interface 8251A, and sends a reset signal to the keyboard. The key buffer is cleared. u The work area that is initialized is shown in the "Related" section. In Hi-Res mode, the shift key code table (0000:0408h), key buffer start address (0000:0410h), key buffer size (0000:0522h), and internal interrupt key setting table address (0000:0418h) are not initialized. o When the keyboard receives a reset signal, it resends the key press status, so the work area showing the various press statuses is correctly reset. Note that the keyboard reset signal is different from the CPU reset signal, and it is a signal that resets only the keyboard. Related ■[Normal, PC-98LT/HA] 0000:0522h 0000:0524h 0000:0526h 0000:0528h 0000:0529h 0000:052A-0539h 0000:053Ah ■[Hi-Res] 0000:0524h 0000:0526h 0000:0528h 0000:0529h 0000:052A-0539h 0000:053Ah INT 18h - Function 04h Classification KEYBOARD BIOS Name Sense of key input state Target Normal, High Resolution, PC-98LT/HA Input AH=04h AL=Key code group number (00-0Fh) Output AH=Key state * Each bit is 1=ON, 0=OFF AL=Undefined Explanation o Returns the pressed state of the key at the time of execution of this function, regardless of the key buffer. The key code group number and bit correspondence for each key are shown in the table [Key code group number and corresponding key]. u When the PC-9800 keyboard is pressed and held down, the keyboard repeats, so there is a period when the key appears not to be pressed from the software even though it is pressed. Note that shift keys, function keys, and the [INS] key do not repeat. The keyboard edition of "PC-9801 Super Techniques" (published by ASCII Publishing Bureau) has a detailed description of repeat. o When pressing a key that the model does not have (such as pressing the vf key when connecting a new keyboard to a model for old keyboards), INT 18h - Function 00h, 01h, 05h, 07h, 08h cannot recognize the key input, but this function can recognize the press. o In high-resolution mode, even if you change the shift key code table (0000:0408-040Fh) or the key data conversion table (address pointed to by 0000:0414h), it does not affect the operation of this function. Related 0000:052A-0539h Table Key code group numbers and corresponding keys -------------+-------+-------+-------+-------+-------+-------+-------+------- Group Number | bit 7 | bit 6 | bit 5 | bit 4 | bit 3 | bit 2 | bit 1 | bit 0 -------------+-------+-------+-------+-------+-------+-------+-------+------- 00h 7' 6& 5% 4$ 3# 2" 1! ESC ヤャ オォ エェ ウゥ アァ フ ヌ 01h TAB BS ¥| ^` -= 0 9) 8( ー ヘ ホ ワヲ ヨョ ユュ 02h I U Y T R E W Q ニ ナ ン カ ス イ テ タ 03h D S A RETURN [{ @‾ P O シ ト チ セ ラ 04h :* ;+ L K J H G F ケ レ リ ノ マ ク キ ハ 05h M N B V C X Z }] モ ミ コ ヒ ソ サ ツッ ム」 06h ROLL ROLL XFER SPACE _ /? .> ,< DOWN UP ロ メ・ ル。 ネ。 07h HELP HOME ↓ → ← ↑ DEL INS CLR 08h 5 4 * 9 8 7 / - 09h , 0 = 3 2 1 + 6 0Ah vf・5 vf・4 vf・3 vf・2 vf・1 NFER . 0Bh HOME 0Ch f・6 f・5 f・4 f・3 f・2 f・1 COPY STOP 0Dh f・10 f・9 f・8 f・7 0Eh CTRL GRPH カナ CAPS SHIFT 0Fh -------------+-------+-------+-------+-------+-------+-------+-------+------- * For differences in keyboards for each model, see the table [Key Codes and Key Data]. INT 18h - Function 05h Classification KEYBOARD BIOS Name Read key code from buffer (1 character input) Target Normal, Hi-Res, PC-98LT/HA Input AH=05h Output BH=Presence of key input data 00h: No key input data 01h: Key input data When BH=01h AH=Key code AL=Key data When BH=00h AX=Undefined Explanation o Extracts one character of key input data from the key buffer and outputs the key code and key data (for key codes and key data, see the table [Key Codes and Key Data]). If there is no key input data in the key buffer, it immediately ends. u Although the technical data book says that it is only for Hi-Res, it can actually be used with normal and PC-98LT/HA. Related 0000:0502-0521h 0000:0524-0525h 0000:0528h Table [Key Code/Key Data] 0000:0410-0413h [Hi-Res] 0000:0522h [Hi-Res] INT 18h - Function 06h Classification KEYBOARD BIOS Name Buffer Initialization Target Hi-Res Input AH=06h Output AX=Undefined Explanation o Clears the key buffer and cancels previous input. o When changing the key buffer start address (0000:0410h) or key buffer size (0000:0522h), this function must be executed. You can also execute INT 18h - Function 03h, but it takes longer to execute than this function because it resets the keyboard. Related 0000:0410h 0000:0524h 0000:0526h 0000:0528h INT 18h - Function 07h Category KEYBOARD BIOS Name Reading shift state and key data (waiting for 1 character input) Target Hi-Res Input AH=07h Output AH=key code AL=key data AX=FFFFh : Finished with no key input BL=shift state Explanation o Extracts 1 character of key input data from the key buffer and outputs the key code, key data, and shift state at the time the key was pressed. Same as INT 18h - Function 00h, except that it also outputs the shift state. See the explanation of INT 18h - Function 00h. For the shift state, see INT 18h - Function 02h. Related INT 18h - Function 00h INT 18h - Function 02h INT 18h - Function 08h Classification KEYBOARD BIOS Name Sense of shift state and key data Target Hi-Res Input AH=08h Output BH=Presence or absence of key input data 00h: No key input data 01h: Key input data When BH=01h AH=Key code AL=Key data When BH=00h AX=Undefined Explanation o Refers to the first character of key input data in the key buffer, and outputs the key code, key data, and shift state. Same as INT 18h - Function 01h, except that it can also refer to the shift state. See the explanation of INT 18h - Function 01h. For the shift state, see INT 18h - Function 02h. u The '92 Technical Data Book does not contain any description of the BH register during output. Related INT 18h - Function 01h INT 18h - Function 02h INT 18h - Function 09h Classification KEYBOARD BIOS Name Key data creation Target Hi-Res Input AH=09h AL=Key number (00-7Fh) BL=Shift state * 00-1Fh if using default key data conversion table Output AH=Key code AL=Key data ■When AL=FFh AH=Undefined No key input is performed with the given key number and shift state combination. Or, no key with the given key number exists. Explanation o Converts key number and shift state to key code and key data. Conversion is performed using the table specified by the key data conversion table address (0000:0414-0417h). For shift state, see INT 18h - Function 02h. u The '92 Technical Data Book states that BL breaks, but in reality it does not change. u Keys defined in the shift key code table (0000:0408-040Fh) or keyboard interrupt table (address pointed to by 0000:0418h) cannot actually have their key codes obtained using INT 18h - Function 00h, etc. However, this function converts such key numbers into key codes and key data even when they are specified. u The default key data conversion table (address pointed to by 0000:0414h) is created to support five (5-bit) shift keys. When using the default key data conversion table, set the shift state only in bits 4-0 of the shift state (BL). Setting a value other than 000b in bits 7-5 will return meaningless data. Related 0000:0414-0417h INT 18h - Function 02h Table [Key Codes and Key Data]